package com.ys.erp.framework.config;

import feign.RequestInterceptor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

/**
 * @author lwj
 * @date 2024/8/29
 */
@SpringBootConfiguration
@EnableFeignClients(basePackages = "com.ys.erp.**.api")
public class FeignClientConfig {

    public static String IS_FEIGN = "X-Feign-Request";

    @Bean
    public RequestInterceptor feignRequestInterceptor() {
        return template -> {
            // 添加标记头到 Feign 请求
            template.header("X-Feign-Request", "yes");
        };
    }

}
